package Test;

import java.util.Scanner;

public class TongJiZiFuGeShu {
    public static void main(String[] args) {
        //键盘录入一个字符串，统计该字符串中大写字母字符，小写字母字符，数字字符出现的次数

        //1.键盘录入一个字符串
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串：");
        String str = sc.next();

        int small = 0;
        int big = 0;
        int num = 0;
        //2.遍历字符串
        for (int i = 0; i < str.length(); i++) {
            //返回字符串的字符
            char c = str.charAt(i);

            //3.统计大小写字符个数
            if (c >= 97 && c < 122){
                small++;
            }else if (c < 97 && c >= 65){
                big++;
            }else if (c <= 57 && c >= 48) {
                num++;
            } else {
                System.out.println(c + "不在统计范围");
            }
        }
        //4.输出
        System.out.println("大写字母个数为：" + big);
        System.out.println("小写字母个数为：" + small);
        System.out.println("数字个数为：" + num);
    }
}
